<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/common.jspf" %>
<html>
<head>
    <title>storetable</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="text/javascript">
        $(function (){
            $('#tableUser').datagrid({
                url:'${proPath}/tableuser/selectPage.action', // user/select.action
                // method:'post',
                //idfield:'productid',
                columns:[[
                    {checkbox:true},
                    {field:'tableNum',title:'餐桌编号',width:100},
                    {field:'tableName',title:'餐桌名称',width:100},
                    {field:'tableWays',title:'就餐形式',width:100},
                    {field:'tableWorkStatus',title:'工作状态',width:100},
                    {field:'tableUserPhone',title:'预约手机',width:100},
                    {field:'tableStartTime',title:'预约开始时间',width:100},
                    {field:'tableEndTime',title:'预约结束时间',width:100},
                    {field:'tableStatus',title:'状态',width:100},
                    {field:'tableCommon',title:'备注',width:100,align:'right'},
                    {field:'tableCreate',title:'创建时间',width:100},
                    {field:'tableUpdate',title:'更新时间',width:100,align:'right'}
                ]],
                fitColumns:true,
                toolbar: [{
                    iconCls: 'icon-edit',
                    text:'修改',
                    handler: function(){
                        //alert('修改按钮');
                        //判断，只能选择一行
                        var array = $('#tableUser').datagrid("getSelections");
                        if(array.length<1){
                            alert("请选择需要修改的用户");
                            return ;
                        }

                        if(array.length>1){
                            alert("只能选择需要一个修改的用户");
                            return ;
                        }
                        //alert(array[0].tableUserId+","+array[0].tableNum+","+array[0].tableName);
                            parent.$('#win').window({
                                width:600,
                                height:300,
                                title:'修改餐桌',
                                modal:true,
                                content:"<iframe src='${proPath}/base/goURL.action?url=tableuser/updateTable' title='修改餐桌' height='100%' width='100%' frameborder='0px'/>"
                            });
                    }
                },'-',{
                    iconCls: 'icon-ok',
                    text:'已使用',
                    handler: function(){
                        alert('预约按钮');
                    }
                }],
                striped:true,
                rownumbers:true,
                pagination:true,
                pageSize:15,
                pageList:[5,10,15,20,25],
                /* queryParams: {
                 userName: 'easyui',
                 userAddress: 'datagrid'
                 } */
            });
            $('#tableCompanyName').combobox('readonly', true);
            $('#tableStoreName').combobox('readonly', true);

            $.extend($.fn.validatebox.defaults.rules, {
                phoneNum: { //验证手机号
                    validator: function(value, param){
                        return /^1[3-8]+\d{9}$/.test(value);
                    },
                    message: '请输入正确的手机号码'
                }
            });
            $('#tableUser').datagrid("reload");
        });
        function search() {
            alert($('#tableWorkStatus').combobox("getValue")+$('#tableUserPhone').val()+$('#tableName').val()+$('#tableNum').val());
            $('#tableUser').datagrid( 'load',{
                //tableCompanyName: $('#tableCompanyName').combobox("getValue"),
                //tableStoreName: $('#tableStoreName').combobox("getValue"),
                tableWorkStatus: $('#tableWorkStatus').combobox("getValue"),
                tableUserPhone: $('#tableUserPhone').val(),
                tableName: $('#tableName').val(),
                tableNum: $('#tableNum').val()
            });
        }
    </script>
<body>
<form id="search">

    <label >总公司：</label>
    <select class="easyui-combobox" id="tableCompanyName" >
        <%--<option value="">--请选择--</option>--%>
        <option >美团外卖</option>
        <option >饿了么</option>
    </select>


    <label >店铺名称：</label>
    <select class="easyui-combobox" id="tableStoreName" >
        <%--<option value="">--请选择--</option>--%>
        <option>中餐厅</option>
        <option>西餐厅</option>
    </select>


    <label >餐桌编号：</label>
    <input class="easyui-validatebox" type="text" id="tableNum" />


    <div>
        <label >餐桌名称：</label>
        <input class="easyui-validatebox" type="text" id="tableName" name="tableName" />

        <label >手机号码：</label>
        <input class="easyui-validatebox" type="text" id="tableUserPhone" name="tableUserPhone" validtype="phoneNum"/>


        <label >工作状态：</label>
        <select  class="easyui-combobox" id="tableWorkStatus" name="tableWorkStatus">
            <option value="">--请选择--</option>
            <option>用餐中</option>
            <option>已预订</option>
            <option>已使用完</option>
        </select>
        <input type="button" onclick="search()" value="查询">
    </div>
</form>
<table id="tableUser"></table>




</body>
</html>